#!/usr/bin/env python 
# -*- coding:utf-8 -*-
import pygame




class SoundControlUtils():
    #导入声源
    #背景音乐
    sound_bgm_supply = pygame.mixer.Sound("sound/bgm_supply.wav")
    sound_bgm_die = pygame.mixer.Sound("sound/bgm_die.wav")


    #游戏阶段bgm
    sound_bgm_level2 = pygame.mixer.Sound("sound/bgm_xuan.wav")


    sound_lastone = pygame.mixer.Sound("sound/bgm_lastone.wav")

    sound_bgm1 = pygame.mixer.Sound("sound/bgm_main.wav")
    sound_bgm_boss = pygame.mixer.Sound("sound/bgm_boss~1.wav")
    sound_bgm_putong = pygame.mixer.Sound("sound/bgm_putong.wav")

    #排行榜界面音效
    sound_bgm_rank = pygame.mixer.Sound("sound/bgm_rank.wav")


    sound_me_down = pygame.mixer.Sound("sound/me_down.wav")

    sound_bgm_hero2bullet = pygame.mixer.Sound("sound/fly.wav")

    sound_boss3 = pygame.mixer.Sound("sound/bgm_boss3.wav")



    #音效

    #战机技能音效
    sound_hero2skill = pygame.mixer.Sound("sound/hero2skill.wav")

    #战机发射子弹音效
    sound_hero1bullet = pygame.mixer.Sound("sound/hero1bullet.WAV")
    sound_hero2bullet = pygame.mixer.Sound("sound/bgm_hero2bullet.wav")

    sound_hero3bullet = pygame.mixer.Sound("sound/hero3bullet.WAV")

    #战机升级音效
    sound_upgrade = pygame.mixer.Sound("sound/upgrade.wav")

    #选择战机后飞行音效
    choose_plane_fly = pygame.mixer.Sound("sound/fly.wav")

    #战机die音效
    hero_die_sound = pygame.mixer.Sound("sound/hero_hit.WAV")



    #boss音效
    #boss爆炸音效
    sound_boss_boom = pygame.mixer.Sound("sound/bgm_boom.wav")

    #进入boss战前预警
    sound_warning = pygame.mixer.Sound("sound/sound_warning.wav")


    #按钮音效
    sound_button = pygame.mixer.Sound("sound/button.wav")

    #补给音效
    sound_supply = pygame.mixer.Sound("sound/supply.wav")



    pygame.mixer.music.load("sound/hundouluo.wav")
    attack_sound = pygame.mixer.Sound("sound/bullet.wav")




    #敌人die音效
    small_die_sound = pygame.mixer.Sound("sound/enemy1_down.wav")


    attack_sound.set_volume(0.2)
    pygame.mixer.music.set_volume(0.2)
    hero_die_sound.set_volume(0.2)

    @staticmethod
    def changeBgmValue(var):
        # 背景音乐
        SoundControlUtils.sound_bgm_supply.set_volume(var)
        SoundControlUtils.sound_bgm_die.set_volume(var)

        # 游戏阶段bgm
        SoundControlUtils.sound_bgm_level2.set_volume(var)

        SoundControlUtils.sound_lastone.set_volume(var)

        SoundControlUtils.sound_bgm1.set_volume(var)
        SoundControlUtils.sound_bgm_boss.set_volume(var)
        SoundControlUtils.sound_bgm_putong.set_volume(var)

        # 排行榜界面音效
        SoundControlUtils.sound_bgm_rank.set_volume(var)

        SoundControlUtils.sound_me_down.set_volume(var)

        SoundControlUtils.sound_bgm_hero2bullet.set_volume(var)

        SoundControlUtils.sound_boss3.set_volume(var)


    #统一改变bgm音量大小
    @staticmethod
    def change_bgm_volume(H_t):
        # 音量
        SoundControlUtils.sound_bgm_boss.set_volume(H_t)
        SoundControlUtils.sound_bgm_putong.set_volume(H_t)
        SoundControlUtils.sound_bgm_rank.set_volume(H_t)
        SoundControlUtils.sound_bgm_level2.set_volume(H_t)
        SoundControlUtils.sound_bgm_die.set_volume(H_t)
        SoundControlUtils.sound_lastone.set_volume(H_t)
        SoundControlUtils.sound_bgm_level2.set_volume(H_t)
        SoundControlUtils.sound_bgm1.set_volume(H_t)


    #统一改变音效大小
    @staticmethod
    def change_soundEffect_volume(H_t):
        SoundControlUtils.attack_sound.set_volume(H_t)
        SoundControlUtils.small_die_sound.set_volume(H_t)
        SoundControlUtils.hero_die_sound.set_volume(H_t)
        SoundControlUtils.sound_bgm_supply.set_volume(H_t)
        SoundControlUtils.sound_hero2skill.set_volume(H_t)
        SoundControlUtils.sound_hero1bullet.set_volume(H_t)
        SoundControlUtils.sound_hero2bullet.set_volume(H_t)
        SoundControlUtils.sound_hero3bullet.set_volume(H_t)
        SoundControlUtils.sound_boss_boom.set_volume(H_t)
        SoundControlUtils.sound_supply.set_volume(H_t)
        SoundControlUtils.sound_upgrade.set_volume(H_t)
        SoundControlUtils.sound_me_down.set_volume(H_t)
        SoundControlUtils.sound_button.set_volume(H_t)
        SoundControlUtils.choose_plane_fly.set_volume(H_t)
        SoundControlUtils.sound_bgm_hero2bullet.set_volume(H_t)
        SoundControlUtils.sound_boss3.set_volume(H_t)

    #全部音量音效关闭
    @staticmethod
    def close_all_sound():
        #音效
        SoundControlUtils.attack_sound.stop()
        SoundControlUtils.small_die_sound.stop()
        SoundControlUtils.hero_die_sound.stop()
        SoundControlUtils.sound_bgm_supply.stop()
        SoundControlUtils.sound_hero2skill.stop()
        SoundControlUtils.sound_hero1bullet.stop()
        SoundControlUtils.sound_hero2bullet.stop()
        SoundControlUtils.sound_hero3bullet.stop()
        SoundControlUtils.sound_boss_boom.stop()
        SoundControlUtils.sound_supply.stop()
        SoundControlUtils.sound_upgrade.stop()
        SoundControlUtils.sound_me_down.stop()
        SoundControlUtils.sound_button.stop()
        SoundControlUtils.choose_plane_fly.stop()
        SoundControlUtils.sound_bgm_hero2bullet.stop()
        SoundControlUtils.sound_boss3.stop()

        #音量
        SoundControlUtils.sound_bgm_boss.stop()
        SoundControlUtils.sound_bgm_putong.stop()
        SoundControlUtils.sound_bgm_rank.stop()
        SoundControlUtils.sound_bgm_level2.stop()
        SoundControlUtils.sound_bgm_die.stop()
        SoundControlUtils.sound_lastone.stop()
        SoundControlUtils.sound_bgm_level2.stop()
        SoundControlUtils.sound_bgm1.stop()